//
//  CRMFollowUpVCViewController.m
//  New_Runway
//
//  Created by NewLife on 2018/3/1.
//  Copyright © 2018年 NelsonJ. All rights reserved.
//

#import "CRMFollowUpListVC.h"

#import "CRMSeeCarVC.h"
#import "CRMContinueFollowUpVC.h"
#import "CRMDealDoneVC.h"
#import "CRMDefeatedVC.h"
#import "CRMExpiredVC.h"

@interface CRMFollowUpListVC ()<UITableViewDelegate, UITableViewDataSource>

@end

@implementation CRMFollowUpListVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationBarView.titleLabel.text = @"跟进意向";
    self.view.backgroundColor = [UIColor whiteColor];
 
    UITableView *tableView = DPTableViewForStyle(UITableViewStylePlain)
    .setBackgroundColor([UIColor whiteColor])
    .setDelegate(self)
    .setDataSource(self)
    .registerCell([UITableViewCell class], @"cell")
    .setTableFooterView(DPView())
    .setFrame(CGRectMake(0, self.navH, Screen_width, Screen_height - self.navH - self.BotH));
    
    self.view.addSubview(tableView);
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return getListArray().count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    
    cell.textLabel
    .setText(getListArray()[indexPath.row])
    .setFont(getPingfangFont(13))
    .setTextColor(getColorFromString(@"323232"));
    
    cell.separatorInset = UIEdgeInsetsZero;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    return 40;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    switch (indexPath.row) {
        case 0:
        {
            CRMSeeCarVC *vc = [CRMSeeCarVC new];
            vc.customerShopId = self.customerShopId;
            [self.navigationController pushViewController:vc animated:YES];
            break;
        }
        case 1:
        {
            CRMContinueFollowUpVC *vc = [CRMContinueFollowUpVC new];
            vc.customerShopId = self.customerShopId;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 2:
        {
            CRMDealDoneVC *vc = [CRMDealDoneVC new];
            vc.customerShopId = self.customerShopId;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 3:
        {
            CRMDefeatedVC *vc = [CRMDefeatedVC new];
            vc.customerShopId = self.customerShopId;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 4:
        {
            CRMExpiredVC *vc = [CRMExpiredVC new];
            vc.customerShopId = self.customerShopId;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        default:
            break;
    }
}

NSArray <NSString *>* getListArray() {
    
    return @[@"预约看车", @"继续跟进", @"已成交", @"已战败", @"已失效"];
}

@end
